﻿@model Etch.OrchardCore.Search.ViewModels.SiteSearchListViewModel

@inject OrchardCore.ContentManagement.Display.IContentItemDisplayManager ContentItemDisplayManager

<section class="section">
    <div class="constrain">
        <form class="form form--horizontal" method="get">
            <input id="filter" name="filter" type="text" value="@Model.Filter" placeholder="@Model.FilterInputPlaceholder" class="input">
            <button type="submit" class="btn btn--primary">@Model.SubmitButtonLabel</button>
        </form>
    </div>
</section>

@if (Model.IsSearching)
{
    <section class="section">
        <div class="constrain">
            <h2>@T["Search Results"]</h2>

            @if (Model.HasResults)
            {
                <ul class="list list--search-results">
                    @foreach (var contentItem in Model.Results)
                    {
                        var contentItemSummary = await ContentItemDisplayManager.BuildDisplayAsync(contentItem, null, Model.ItemsDisplayType);

                        <li class="list__item">
                            @await DisplayAsync(contentItemSummary)
                        </li>
                    }
                </ul>

                @await DisplayAsync(Model.Pager)
            } else
            {
                <p>@T["Unable to find anything that matches your search."]</p>
            }
        </div>
    </section>
}